package com.flight.model.service.impl;

import com.flight.model.dao.PassengerDAO;
import com.flight.model.dao.impl.PassengerDAOImpl;
import com.flight.model.entity.Passenger; // 补充导入
import com.flight.model.service.PassengerService;

public class PassengerServiceImpl implements PassengerService {
    private PassengerDAO passengerDAO = new PassengerDAOImpl();

    @Override
    public boolean register(Passenger passenger) {
        // 业务校验：身份证号不能重复
        if (passengerDAO.getByPassengerId(passenger.getPassengerId()) != null) {
            return false;
        }
        return passengerDAO.addPassenger(passenger);
    }

    @Override
    public Passenger getPassengerById(String passengerId) { // 修正方法名与接口一致
        return passengerDAO.getByPassengerId(passengerId);
    }
}